Skip to content

Restructure influxdb3 /plugins for step-by-step clarity #5963

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 117 commits into
base: master
Choose a base branch
from

Conversation

MeelahMe
Copy link
Contributor

@MeelahMe MeelahMe commented Apr 4, 2025

**Objective:

To revise the /plugins section to be more structured and step-by-step than it is now. The goal is to make it easier for users to understand how plugins work, how to configure them, and how to build or extend them—especially for those who are new to InfluxDB 3 or plugin-based architectures.

What the feature does and why it’s useful

  • Transforms the current /plugins documentation into a more linear, guided experience
  • Helps users understand the purpose, setup, and customization of plugins
  • Reduces confusion and improves onboarding by clearly walking through key workflows
  • How to use it

Once updated, users should be able to:

  • Understand what plugins are and how they fit into the system
  • Follow clear, step-by-step instructions to enable, configure, and test plugins
  • Extend or write their own plugins, if applicable

part of #5857
closes #5951

@MeelahMe MeelahMe linked an issue Apr 4, 2025 that may be closed by this pull request
@MeelahMe MeelahMe self-assigned this Apr 4, 2025
@MeelahMe MeelahMe changed the title Restructure influxdb3 /plugins for step-by-step clarit WIP: Restructure influxdb3 /plugins for step-by-step clarit Apr 4, 2025
@MeelahMe MeelahMe changed the title WIP: Restructure influxdb3 /plugins for step-by-step clarit WIP: Restructure influxdb3 /plugins for step-by-step clarity Apr 4, 2025
@MeelahMe MeelahMe requested a review from Copilot April 14, 2025 21:05
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

content/shared/v3-core-plugins/extended-plugin-api.md:189

  • [nitpick] The placeholder 'METHOD' and 'PARAMETERS' may confuse users. Consider either replacing these with concrete examples or adding a clarifying comment that indicates these are placeholders.
influxdb3_local.cache.METHOD(PARAMETERS)

content/shared/v3-core-plugins/extended-plugin-api.md:95

  • [nitpick] Ensure that converting a float with no decimal component to an integer and appending '.0' meets the intended behavior and formatting requirements. Verify this behavior remains consistent with all usage scenarios.
self.fields[key] = f"{int(value)}.0" if value % 1 == 0 else str(value)

@MeelahMe MeelahMe changed the title WIP: Restructure influxdb3 /plugins for step-by-step clarity Restructure influxdb3 /plugins for step-by-step clarity Apr 15, 2025
@MeelahMe MeelahMe requested a review from Copilot May 5, 2025 22:34
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR restructures the plugins documentation to provide a more step-by-step guide, making it easier for users to understand and work with the plugin API.

  • Introduces a comprehensive "extended-plugin-api.md" with detailed usage examples and guidelines.
  • Updates enterprise plugins navigation for consistency in naming.
  • Adds two extend-plugin markdown files (for enterprise and core) that reference the shared API content.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

File Description
content/shared/extended-plugin-api.md New detailed API documentation with usage examples and guidelines for caching and plugin operations.
content/influxdb3/enterprise/plugins.md Minor text update for naming consistency in the menu.
content/influxdb3/enterprise/extend-plugin.md New file to extend plugins using the shared API.
content/influxdb3/core/extend-plugin.md New file to extend plugins using the shared API.
Comments suppressed due to low confidence (1)

content/shared/extended-plugin-api.md:15

  • The in-memory cache sections appear duplicative, with a top-level 'Maintain state with in-memory cache' (lines 10-14) and a separate 'Guidelines for in-memory caching' (lines 15-17). Consider consolidating or clarifying the distinct purposes to avoid confusion.
- [Guidelines for in-memory caching](#guidelines-for-in-memory-caching)

@MeelahMe MeelahMe requested a review from jstirnaman May 5, 2025 22:34
Comment on lines 126 to 134
- Can receive keyword arguments (as `args`) from _trigger arguments_
- Can access the `influxdb3_local` shared API for writing, querying, and managing state

1. Create a `.py` file in your plugins directory
2. Define a function with one of the following signatures:
### Create a custom plugin

#### For data write events
When you need custom functionality, you can create your own plugin by doing the following:

- [Choose your plugin type](#choose-your-plugin-type)
- [Create your plugin file](#create-your-plugin-file)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Can receive keyword arguments (as `args`) from _trigger arguments_
- Can access the `influxdb3_local` shared API for writing, querying, and managing state
1. Create a `.py` file in your plugins directory
2. Define a function with one of the following signatures:
### Create a custom plugin
#### For data write events
When you need custom functionality, you can create your own plugin by doing the following:
- [Choose your plugin type](#choose-your-plugin-type)
- [Create your plugin file](#create-your-plugin-file)
Plugins:
- receive plugin-specific inputs such as written data, call time, or an HTTP request
- receive keyword arguments that you provide in trigger definitions (as `args`)
- can call the `influxdb3_local` API to write data, run queries, and manage state
### Create a custom plugin
Follow steps to create a plugin that meets your unique requirements.
1. [Choose your plugin type](#choose-your-plugin-type)
2. [Create your plugin file](#create-your-plugin-file)
3. [Next steps](#next-steps)

This section is out of place between example and custom plugins. You could also link to the new "extend-plugin" page.

Comment on lines 439 to 450
influxdb3 create trigger \
--trigger-spec "every:1h" \
--plugin-filename "threshold_check.py" \
--trigger-arguments threshold=90,[email protected] \
--database my_database \
threshold_monitor
```

##### Share data across plugins
Your plugin accesses these values through the `args` parameter:

```python
# Store in the global namespace
influxdb3_local.cache.put("config", {"version": "1.0"}, use_global=True)

# Retrieve from the global namespace
config = influxdb3_local.cache.get("config", use_global=True)
def process_scheduled_call(influxdb3_local, call_time, args=None):
if args and "threshold" in args:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we still need this, move it to the earlier section about trigger arguments.

MeelahMe and others added 23 commits May 6, 2025 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Restructure influxdb3 /plugins for step-by-step clarity
2 participants